package day30;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Stack;

/**
 * @author ZJX
 * @version 1.0
 * @descption
 * @since 2025/11/6 10:38
 */
public class Day23 {

//    public static void main(String[] args) throws IOException {
//        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//        PrintWriter out = new PrintWriter(System.out);
//        in.nextToken();
//        int t = (int) in.nval;
//        while (t-- > 0) {
//            in.nextToken();
//            int h = (int) in.nval;  // 小写的是自己的的 大写的是野怪的  我先手
//            in.nextToken();
//            int a = (int) in.nval;
//            in.nextToken();
//            int H = (int) in.nval;
//            in.nextToken();
//            int A = (int) in.nval;
//
//            if (a >= H) {
//                out.println(-1);
//                continue;
//            }
//            int time = (H + a - 1) / a; // 攻击time下 野怪over  向上取整
//            int YGtime = time - 1;
//            int count = 0;
//            while (h > 0) {
//                h -= (YGtime * A);
//                if (h > 0) {
//                    count++;
//                } else {
//                    break;
//                }
//            }
//            out.println(count);
//        }
//        out.close();
//    }


    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int n = Integer.parseInt(br.readLine());
        HashSet<String> set = new HashSet<>();
        while (n-- > 0) {
            char[] array = br.readLine().toCharArray();
            Arrays.sort(array);
            set.add(new String(array));
        }
        out.println(set.size());
        out.close();
    }

    /**
     * 力扣 547 省份数量 全局变量 vis 跟 n 减少传参
     */
    boolean[] vis = new boolean[200];
    int n;

    public int citys(ArrayList<ArrayList<Integer>> m) {
        int ret = 0;
        n = m.size();
        for (int i = 0; i < n; i++) {
            if (!vis[i]) {
                ret++;
                dfs(m, i);
            }
        }
        return ret;
    }

    private void dfs(ArrayList<ArrayList<Integer>> m, int pos) {
        vis[pos] = true;
        for (int i = 0; i < n; i++) {
            if (m.get(pos).get(i) == 1 && !vis[i]) {
                dfs(m, i);
            }
        }
    }

    public int findCircleNum(int[][] isConnected) {
        int n = isConnected.length;
        boolean[] visit = new boolean[n];
        int ret = 0;

        for (int i = 0; i < n; i++) {
            if (!visit[i]) {
                dfsFind(isConnected, i, visit, n);
                ret++;
            }
        }
        return ret;
    }

    private void dfsFind(int[][] isConnected, int pos, boolean[] visit, int n) {
        visit[pos] = true;
        for (int i = 0; i < n; i++) {
            if (isConnected[pos][i] == 1 && !visit[i]) {
                dfsFind(isConnected, i, visit, n);
            }
        }
    }

    // 打家劫舍2
    public int rob(int[] nums) {
        int n = nums.length;
        if (n == 1) {
            return nums[0];
        }
        int[] dp1 = new int[n];
        // 不抢第一个
        dp1[0] = 0;
        dp1[1] = nums[1];
        for (int i = 2; i < n; i++) {
            dp1[i] = Math.max(dp1[i - 1], dp1[i - 2] + nums[i]);
        }

        int[] dp2 = new int[n];
//        不抢最后一个
        dp2[0] = nums[0];
        dp2[1] = Math.max(nums[0], nums[1]);
        for (int i = 2; i < n - 1; i++) {
            dp2[i] = Math.max(dp2[i - 1], dp2[i - 2] + nums[i]);
        }
        return Math.max(dp2[n - 2], dp1[n - 1]);
    }


    public String decodeString(String _s) {
        Stack<StringBuffer> st = new Stack<>();
        st.push(new StringBuffer());

        Stack<Integer> nums = new Stack<>();
        int i = 0, n = _s.length();
        char[] s = _s.toCharArray();
        while (i < n) {
            if (s[i] >= '0' && s[i] <= '9') {
                int tmp = 0;
                while (i < n && s[i] >= '0' && s[i] <= '9') {
                    tmp = tmp * 10 + (s[i] - '0');
                    i++;
                }
                nums.push(tmp);
            } else if (s[i] == '[') {
                i++;
                StringBuffer tmp = new StringBuffer();
                while (i < n && s[i] >= 'a' && s[i] <= 'z') {
                    tmp.append(s[i]);
                    i++;
                }
                st.push(tmp);
            } else if (s[i] == ']') {

                StringBuffer tmp = st.pop();
                int k = nums.pop();
                while (k-- != 0) {
                    st.peek().append(tmp);
                }
                i++;
            } else {
                StringBuilder tmp = new StringBuilder();
                while (i < n && s[i] >= 'a' && s[i] <= 'z') {
                    tmp.append(s[i]);
                    i++;
                }
                st.peek().append(tmp);
            }
        }
        return st.peek().toString();
    }

}

